/**
 * author:wos
 * time:2024-1-14
 * title:上传
 */
const mime = require('mime-types'),
    uploadStatus = require('../../utils/uploadStatus')
async function upload(ctx, next) {
    let file = ctx.request.files.file
    console.log( ctx.request.files )
    let files = ctx.request.files
    let result = []
    for (let i in files) {
        //对上传文件回调统一业务处理方法
        if(uploadStatus(ctx, files[i])){
            const item = {
                "uri":global.config.upload.uriPrefix + files[i].newFilename,
                "size":files[i].size,
                "mimetype":files[i].mimetype
            }
            result.push(item)
        }
    }


    global.response(ctx, {
        "status":200,
        "code": 200,
        "data": result,
        "msg":'上传成功'
    })



}
module.exports = upload


